<?php 
require_once APPPATH.'controllers/app.php';
class Resources extends App {
    function __construct() {
        parent::__construct();
        $this->load->database();
        $this->load->library('grocery_CRUD');
    }
    function index(){
        $crud = new grocery_CRUD();
        $crud->set_subject('Tài nguyên');
        $crud->set_table('tblresources');
        $crud->set_relation('timetypeid','tbltimetype','name');
        $crud->set_relation('calenderid','tblcalenders','name');
        $crud->display_as('name','Tên tài nguyên');
        $crud->display_as('cost','Chi phí');
        $crud->display_as('otcost','Chi phí ngoài giờ');
        $crud->display_as('timetypeid','Loại thời gian');
        $crud->display_as('calenderid','Lịch làm việc');
        $crud->required_fields('name','cost','otcost','timetypeid','calenderid');
        $crud->set_rules('cost','Chi phí','numeric');
        $crud->set_rules('otcost','Chi phí','numeric');
        $output = $crud->render();
        $output->title = "Tài nguyên";
        $output->content_title = "Danh sách tài nguyên";
        $output->sb = $this->_menu;
        $this->load->view('common/layout_view',$output);
   }
}
